//类似java的静态工厂方法
function createUser(name, interests) {
    var user = {};
    user.name = name;
    user.interests = interests;
    user.greeting = function() {
        console.log('Hi, I\'m ' + this.name + '.');
    }

    return user;
}

var user = createUser('Sunny', ['Traveling', 'Swimming']);
user.greeting();